package com.webflux.dmeo.functionCompileDemo;

/**
 * Created by wangzhanjin on 2018/5/30.
 */
public class ThreadDemo {
    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("OK");
            }
        }).start();

        //lambda，不需要知道我需要实现runnable接口
        new Thread(()-> System.out.println("OK啦")).start();
        Runnable runnable = () -> System.out.println("返回的函数实现的接口方式");
        new Thread(runnable).start();
        Object obj = (Runnable)() -> System.out.println("强转");
        new Thread((Runnable)obj).start();
        System.out.println(runnable==obj);//false
    }
}
